package com.hxx.springbootdemo.consumer.controller;

import com.hxx.springbootdemo.consumer.redisClusterConfig.RedisClusterConfig;
import com.hxx.springbootdemo.consumer.redisClusterConfig.RedisProperties;
import com.hxx.springbootdemo.consumer.service.JedisClientCluster;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class RedisClusterController {
    @Autowired
    private RedisProperties redisProperties;

    @Autowired
    private RedisClusterConfig redisClusterConfig;

    @Autowired
    private JedisClientCluster jedisClientCluster;

    @GetMapping(value = "getRedisValue")
    public String getRedisValue(){
        System.out.println(redisProperties.toString());
        System.out.println(redisClusterConfig.getJedisCluster().getClusterNodes());
        System.out.println(jedisClientCluster.get("yp"));
        jedisClientCluster.set("12","12");
        System.out.println(jedisClientCluster.get("12"));
        return jedisClientCluster.get("12");
    }
}
